package com.hechang.service;

import java.io.IOException;

import com.hechang.constant.API;
import com.hechang.constant.SystemConstant;
import com.hechang.dto.User;
import com.google.gson.Gson;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

/**
 *
 */
@Service
public class UserService {
	Logger logger = Logger.getLogger(UserService.class);

    public User getUser( String id,String name,String store,String resources) {
        User user =new User();
        user.setName(name);
        user.setId(id);
        user.setStore(store);
        user.setResources(resources);
        return user;
    }
    
    public User userLogin(User user,
            HttpServletRequest request) throws Exception {
            HttpSession session = request.getSession();
            session.setAttribute(SystemConstant.SESSION_USER_KEY, user);
        return user;
    }
}
